
/* JavaScript content from js/loadmap.js in folder common */
(function(){
	var script = document.createElement('script');
	script.type = 'text/javascript';
	if(window.page == 0) {
		script.src = 'https://maps.googleapis.com/maps/api/js?key=AIzaSyAuBWJtxkiuJGQ_IpfGxJJFAnoLSE59DVo&sensor=false&'
			+ 'callback=initialize&language=zh-CN&&libraries=places';
	}else if(window.page == 1) {
		script.src = 'https://maps.googleapis.com/maps/api/js?key=AIzaSyAuBWJtxkiuJGQ_IpfGxJJFAnoLSE59DVo&sensor=false&'
			+ 'callback=initialize&language=zh-CN&libraries=geometry';
	}
	document.body.appendChild(script);
	
})(jQuery);


function initialize() {
	var i = 0;
//	alert("iii" + window.page);
	navigator.geolocation.getCurrentPosition(function(position){
		var initialLoc = new google.maps.LatLng(position.coords.latitude, position.coords.longitude);
		var mapOptions = {
			zoom: 16,
			mapTypeId: google.maps.MapTypeId.ROADMAP,
			center: initialLoc,
			panControl : false,
			zoomControl : false,
			scaleControl : false,
			streetViewControl : false,
			overviewMapControl : false,
			mapTypeControl : false
		};
		var map1 = window.map = new google.maps.Map(document.getElementById("mapContainer"), mapOptions);
		
		window.markerPassager = new google.maps.Marker({
			visible: true,
			position: initialLoc,
			map: map1
		});
		busy.hide();
		window.customer.latitude = position.coords.latitude;
		window.customer.longitude = position.coords.longitude;
		window.passagerLatLng = initialLoc;
	});		
}